import { FormGroup } from "@angular/forms";

/**
 * 转化成RMB元字符串
 *
 * @param digits 当数字类型时，允许指定小数点后数字的个数，默认2位小数
 */
const fnYuan =  function yuan(value: number | string, digits = 2): string {
	if (typeof value === 'number') {
		value = value.toFixed(digits);
	}
	return `&yen ${value}`;
}

const fnUpdateForm = function updateForm(form: FormGroup): boolean {
  Object.keys(form.controls).forEach(key => {
    form.controls[key].markAsDirty();
    form.controls[key].updateValueAndValidity();
  });
  return form.valid;
};



export {fnYuan, fnUpdateForm}